<div class="content-page">
  <!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
  
  http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
  <div id="intro-page">
    <page-title title=" Users" icon="&#128100;"></page-title>
  </div>
  <bsmodal id="newUser" title="Create New User" close="hideModal"
    closelabel="Cancel" buttonid="users" extrabutton="newUserDialog"
    extrabuttonlabel="Create" ng-cloak>
  <fieldset>
    <div class="control-group">
      <label for="new-user-username">Username</label>

      <div class="controls">
        <input type="text" required
          ng-model="$parent.newUser.newusername"
          ng-pattern="usernameRegex"
          ng-attr-title="{{usernameRegexDescription}}" name="username"
          id="new-user-username" class="input-xlarge" ug-validate />
        <p class="help-block hide"></p>
      </div>
    </div>
    <div class="control-group">
      <label for="new-user-fullname">Full name</label>

      <div class="controls">
        <input type="text" required
          ng-attr-title="{{nameRegexDescription}}"
          ng-pattern="nameRegex" ng-model="$parent.newUser.name"
          name="name" id="new-user-fullname" class="input-xlarge"
          ug-validate />

        <p class="help-block hide"></p>
      </div>
    </div>
    <div class="control-group">
      <label for="new-user-email">Email</label>

      <div class="controls">
        <input type="email" required ng-model="$parent.newUser.email"
          pattern="emailRegex" ng-attr-title="{{emailRegexDescription}}"
          name="email" id="new-user-email" class="input-xlarge"
          ug-validate />

        <p class="help-block hide"></p>
      </div>
    </div>
    <div class="control-group">
      <label for="new-user-password">Password</label>

      <div class="controls">
        <input type="password" required ng-pattern="passwordRegex"
          ng-attr-title="{{passwordRegexDescription}}"
          ng-model="$parent.newUser.newpassword" name="password"
          id="new-user-password" ug-validate class="input-xlarge" />

        <p class="help-block hide"></p>
      </div>
    </div>
    <div class="control-group">
      <label for="new-user-re-password">Confirm password</label>

      <div class="controls">
        <input type="password" required ng-pattern="passwordRegex"
          ng-attr-title="{{passwordRegexDescription}}"
          ng-model="$parent.newUser.repassword" name="re-password"
          id="new-user-re-password" ug-validate class="input-xlarge" />

        <p class="help-block hide"></p>
      </div>
    </div>
  </fieldset>
  </bsmodal>

  <bsmodal id="deleteUser" title="Delete User" close="hideModal"
    closelabel="Cancel" extrabutton="deleteUsersDialog"
    extrabuttonlabel="Delete" buttonid="deleteusers" ng-cloak>
  <p>Are you sure you want to delete the user(s)?</p>
  </bsmodal>

  <section class="row-fluid">
    <div id="intro-list" class="span3 user-col">

      <div class="button-toolbar span12">
        <a title="Select All" class="btn btn-primary toolbar select-all"
          ng-show="hasUsers"
          ng-click="selectAllEntities(usersCollection._list,this,'usersSelected',true)"
          ng-model="usersSelected"> <i class="pictogram">&#8863;</i></a>
        <button title="Delete" class="btn btn-primary toolbar"
          ng-disabled="!hasUsers || !valueSelected(usersCollection._list)"
          ng-click="showModal('deleteUser')" id="delete-user-button">
          <i class="pictogram">&#9749;</i>
        </button>
        <button title="Add" class="btn btn-primary toolbar"
          ng-click="showModal('newUser')" id="new-user-button"
          ng-attr-id="new-user-button">
          <i class="pictogram">&#57347;</i>
        </button>
        <a class="help_tooltip"
          ng-mouseover="help.sendTooltipGA('users add remove buttons')"
          ng-show="help.helpTooltipsEnabled" href="#"
          ng-attr-tooltip="{{tooltip_users_add_remove_buttons}}"
          tooltip-placement="right">(?)</a>
      </div>
      <ul class="user-list">
        <li
          ng-class="selectedUser._data.uuid === user._data.uuid ? 'selected' : ''"
          ng-repeat="user in usersCollection._list"
          ng-click="selectUser(user._data.uuid)"><input
          type="checkbox" id="user-{{user.get('username')}}-checkbox"
          ng-value="user.get('uuid')" ng-checked="master"
          ng-model="user.checked"> <a
          href="javaScript:void(0)"
          id="user-{{user.get('username')}}-link">{{user.get('username')}}</a>
          <span ng-if="user.name" class="label">Display Name:</span>{{user.name}}
        </li>
      </ul>
      <div style="padding: 10px 5px 10px 5px">
        <button class="btn btn-primary toolbar" ng-click="getPrevious()"
          style="display: {{previous_display">< Previous</button>
        <button class="btn btn-primary toolbar" ng-click="getNext()"
          style="display: {{next_display">Next ></button>
      </div>

    </div>

    <div id="{{help.showTabsId}}" class="span9 tab-content"
      ng-show="hasUsers">
      <div class="menu-toolbar">
        <ul class="inline">
          <li class="tab"
            ng-class="currentUsersPage.route === '/users/profile' ? 'selected' : ''"><div
              class="btn btn-primary toolbar">
              <a class="btn-content"
                ng-click="selectUserPage('/users/profile')"><i
                class="pictogram">&#59170;</i>Profile</a> <a
                class="help_tooltip"
                ng-mouseover="help.sendTooltipGA('users profile tab')"
                ng-show="help.helpTooltipsEnabled" href="#"
                ng-attr-tooltip="{{tooltip_profile_tab}}"
                tooltip-placement="right">(?)</a>
            </div></li>
          <li class="tab"
            ng-class="currentUsersPage.route === '/users/groups' ? 'selected' : ''"><div
              class="btn btn-primary toolbar">
              <a class="btn-content"
                ng-click="selectUserPage('/users/groups')"><i
                class="pictogram">&#128101;</i>Groups</a> <a
                class="help_tooltip"
                ng-mouseover="help.sendTooltipGA('users groups tab')"
                ng-show="help.helpTooltipsEnabled" href="#"
                ng-attr-tooltip="{{tooltip_groups_tab}}"
                tooltip-placement="right">(?)</a>
            </div></li>
          <li class="tab"
            ng-class="currentUsersPage.route === '/users/activities' ? 'selected' : ''"><div
              class="btn btn-primary toolbar">
              <a class="btn-content"
                ng-click="selectUserPage('/users/activities')"><i
                class="pictogram">&#59194;</i>Activities</a> <a
                class="help_tooltip"
                ng-mouseover="help.sendTooltipGA('users activities tab')"
                ng-show="help.helpTooltipsEnabled" href="#"
                ng-attr-tooltip="{{tooltip_activities_tab}}"
                tooltip-placement="right">(?)</a>
            </div></li>
          <li class="tab"
            ng-class="currentUsersPage.route === '/users/feed' ? 'selected' : ''"><div
              class="btn btn-primary toolbar">
              <a class="btn-content"
                ng-click="selectUserPage('/users/feed')"><i
                class="pictogram">&#128196;</i>Feed</a> <a
                class="help_tooltip"
                ng-mouseover="help.sendTooltipGA('users feed tab')"
                ng-show="help.helpTooltipsEnabled" href="#"
                ng-attr-tooltip="{{tooltip_feed_tab}}"
                tooltip-placement="right">(?)</a>
            </div></li>
          <li class="tab"
            ng-class="currentUsersPage.route === '/users/graph' ? 'selected' : ''"><div
              class="btn btn-primary toolbar">
              <a class="btn-content"
                ng-click="selectUserPage('/users/graph')"><i
                class="pictogram">&#9729;</i>Graph</a> <a
                class="help_tooltip"
                ng-mouseover="help.sendTooltipGA('users graph tab')"
                ng-show="help.helpTooltipsEnabled" href="#"
                ng-attr-tooltip="{{tooltip_graph_tab}}"
                tooltip-placement="top">(?)</a>
            </div></li>
          <li class="tab"
            ng-class="currentUsersPage.route === '/users/roles' ? 'selected' : ''"><div
              class="btn btn-primary toolbar">
              <a class="btn-content"
                ng-click="selectUserPage('/users/roles')"><i
                class="pictogram">&#127758;</i>Roles &amp; Permissions</a> <a
                class="help_tooltip"
                ng-mouseover="help.sendTooltipGA('users roles tab')"
                ng-show="help.helpTooltipsEnabled" href="#"
                ng-attr-tooltip="{{tooltip_roles_tab}}"
                tooltip-placement="top">(?)</a>
            </div></li>
        </ul>
      </div>
      <span ng-include="currentUsersPage.template"></span>
    </div>
  </section>
</div>
